package me.jiatao.wan.data.repository

import androidx.paging.PagingData
import kotlinx.coroutines.flow.Flow
import me.jiatao.wan.data.network.HttpResult
import me.jiatao.wan.data.network.HttpStatusResult
import me.jiatao.wan.data.network.pojo.BannerPojo
import me.jiatao.wan.data.network.pojo.CategoryTreePojo
import me.jiatao.wan.data.network.pojo.NavTreePojo
import me.jiatao.wan.data.network.pojo.UserLoginPojo
import me.jiatao.wan.model.ArticleModel

/**
 * @Author: taojia
 * @CreateDate: 2021/8/24 4:39 下午
 * @Version: 1.0
 * @Description: Repository用于数据获取(网络数据拉取，数据库存储)与展示(通知UI层数据更新)
 *
 */

interface Repository {
    /**
     * 获取首页banner列表
     */
    fun fetchBannerList(): Flow<HttpStatusResult<List<BannerPojo>>>

    /**
     * 首页文章列表
     */
    fun fetchHomeArticleList(): Flow<PagingData<ArticleModel>>

    /**
     * 获取类别列表
     */
    fun fetchProjectTree(): Flow<HttpStatusResult<List<CategoryTreePojo>>>

    /**
     * 获取项目模块文章列表
     */
    fun fetchProjectArticleList(cid: Int): Flow<PagingData<ArticleModel>>

    /**
     * 获取体系列表
     */
    fun fetchCategoryTree(): Flow<HttpStatusResult<List<CategoryTreePojo>>>

    /**
     * 获取常用网址
     */
    fun fetchNavTree(): Flow<HttpStatusResult<List<NavTreePojo>>>

    /**
     * 用户登录
     */
    fun postUserLogin(userName: String, userPwd: String): Flow<HttpStatusResult<UserLoginPojo>>
}